package com.cx.controller;

import com.cx.entity.Category;
import com.cx.entity.HomeDto;
import com.cx.entity.RestResp;
import com.cx.service.CategoryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @ClassName: CommonController
 * @Description:
 * @Author: cx
 * @Date: 2023/12/18 16:31
 **/
@RestController
@RequestMapping("/common")
public class    CommonController {
    @Autowired
    private CategoryService categoryService;

    @GetMapping("/home")
    public RestResp select() {

        HomeDto dto = new HomeDto();
        dto.setCollect(111);
        dto.setCollectTotal(222);
        dto.setId(333);
        dto.setPayTotal(444);
        dto.setViews(555);
        dto.setViewsTotal(666);
        dto.setSale(456231);
        dto.setSaleTotal(4561312);
        return RestResp.success(dto);
    }

    /**
     * @return com.cx.entity.RestResp
     * @Description //产品分页function
     * @Param No such property: code for class: Script1
     * @Date 2024/1/15 11:39
     * @Author cx
     **/
    @GetMapping("/category/paging")
    public RestResp categoryPaging(@RequestParam("pageNum") Integer pageNum) {
        List<Category> paging = categoryService.paging(pageNum, 10);
        return RestResp.success(paging);
    }
}
